#include <iostream>
#include <cstring>
using namespace std;

// the input number
char g_num[81];

// in step1 : for each subsequence g_num[0:i], g_segment[i] stores the length of the last segment
// in step2 : for each subsequence g_num[i:END], g_segent[i] stores the largetest length of the first segment
short g_segment[81]; 

int cmp(int start1, int len1, int start2, int len2)
{
	while (g_num[start1] == '0' && len1 > 0) { ++start1; --len1; }
	while (g_num[start2] == '0' && len2 > 0) { ++start2; --len2; }
	
	if (len1 != len2) { return len1 - len2; }
	
	for (int i = 0; i < len1; ++i)
	{
		if (g_num[start1+i] != g_num[start2+i])
		{
			return g_num[start1+i] - g_num[start2+i];
		}
	}
	
	return 0;
}

void dpFromFirstToLast()
{
	int start = 0;
	while (g_num[start] == '0')
	{
		g_segment[start] = 0;
		++start;
	}
	g_segment[start] = start + 1;
	
	for (int i = start+1; i < (int)strlen(g_num); ++i)
	{
		int j = i - 1;
		for (; j >= 0; --j)
		{
			if (cmp(j-g_segment[j]+1, g_segment[j], j+1, i-j) < 0)
			{
				break;
			}
		}
		g_segment[i] = i - j;
	}
}

void dpFromLastToFirst()
{
	int len = (int)strlen(g_num);
	
	int tail = len - g_segment[len-1];
	g_segment[tail] = g_segment[len-1];
	
	for (int i = tail-1; i >= 0; --i)
	{
		if (g_num[i] == '0')
		{
			g_segment[i] = g_segment[i+1] + 1;
			continue;
		}
		
		for (int j = tail; j > i; --j)
		{
			if (cmp(i, j-i, j, g_segment[j]) < 0)
			{
				g_segment[i] = j - i;
				break;
			}
		}
	}
}

int main()
{
	cin >> g_num;
	
	while (!(g_num[0] == '0' && g_num[1] == '\0'))
	{
		dpFromFirstToLast();
		dpFromLastToFirst();
		
		int len = strlen(g_num);
		int segLen = g_segment[0];
		int currSegLen = 0;
		for (int i = 0; i < len; ++i)
		{
			cout << g_num[i];
			currSegLen++;
			if (currSegLen == segLen && i < len-1)
			{
				cout << ',';
				segLen = g_segment[i+1];
				currSegLen = 0;
			}
		}
		
		cout << endl;
		
		cin >> g_num;
	}
	
	return 0;
}
